package cn.yikaojiuguo.student.ui.global;

import android.os.Bundle;

import java.util.ArrayList;

import butterknife.ButterKnife;
import cn.yikaojiuguo.student.R;
import cn.yikaojiuguo.student.app.YiKaoApplication;
import cn.yikaojiuguo.student.bean.AskTeachers;
import cn.yikaojiuguo.student.bean.Member;
import cn.yikaojiuguo.student.support.database.MyDBManager;
import cn.yikaojiuguo.student.support.utils.LogUtil;
import cn.yikaojiuguo.student.ui.ask.AskDetailActivity;
import cn.yikaojiuguo.student.ui.base.CustomerActionBarActivity;

public class WelcomeActivity extends CustomerActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        ButterKnife.bind(this);
        initEvents();
//        if(YiKaoApplication.isLogin()) {
//            startActivity(HomeActivity.newIntent(ArgsConstants.TAB_MY));
//        } else {
//            startActivity(new Intent(this, LoginActivity.class));
//        }
        AskTeachers askTeachers = new AskTeachers();
        askTeachers.askId = 166+"";
        askTeachers.teachers = new ArrayList<Member>(1);
        Member member = new Member();
        member.avatar = YiKaoApplication.getUserAvatar();
        askTeachers.teachers.add(member);
        startActivity(AskDetailActivity.startAskInstance(askTeachers));
        finish();
    }

    private void initEvents() {
        if(YiKaoApplication.isFirstStart()) {//第一次启动或者更新过
            LogUtil.showInfoLog(mTag,"first start");
            //升级数据库
            MyDBManager.checkDatabase();
        }
    }
}
